package com.kuangshenJVM.chapter11;

import com.kuangshenJVM.chapter10.Test10;

public class Test11 {
    static {
        System.out.println("静态实例化之前");
    }
    private static Test11 test11 = new Test11();
    static {
        System.out.println("静态实例化之后");
    }
    public static int x = 0;
    public static int y;

    static {
        x++;
        y++;
    }

    int i = 100;

    private Test11(){
        System.out.println("Test11的构造函数");
        System.out.println("X++ 之前 X = " + x);
        System.out.println("Y++ 之前 Y = " + y);
        x++;
        y++;
        System.out.println("X++ 之后 X = " + x);
        System.out.println("Y++ 之后 Y = " + y);
    }
    public static Test11 getInstance(){
        return test11;
    }

    public static void main(String[] args) {
        Test11 instance = getInstance();
        System.out.println("X = " + x);
        System.out.println("Y = " + y);

        System.out.println(instance.i);

    }

}
